<nav aria-label="Page navigation">
  <ul class="pagination">

    <li>
      <a href="?page={$rets.prev}&sort={$rets.sort}" aria-label="上一页">
        <span aria-hidden="true">上一页</span>
      </a>
    </li>


    {assign name="p" value="$rets" /}
    {assign name="c" value="$rets.curr" /}
    {assign name="t" value="5" /*当前页左右的按钮数*/ }
    {assign name="m" value="$t+3" /*基准线1*/ /}
    {assign name="n" value="$p.pages-$t-2" /*基准线2*/ /}


    {for start="1" end="$p.pages+1"}
      {assign name="ok" value="0"}
      {if ($i==1) or ($i==$p.pages) or ($i>=$c-$t and $i<=$c+$t) or ($c<=$m and $i<=$m+$t) or ($c>=$n and $i>=$n-$t) or ($m>=$n and ($i<=$m or $i>=$n)) }
        {assign name="ok" value="1"}
      {/if}
      {if $ok==1 }
      <li class="{$rets.curr==$i?'active':''}"><a href="?page={$i}&sort={$rets.sort}">{$i}</a></li>
      {/if}
      {if ($i==2 and $ok==0) or ($i==$p.pages-1 and $ok==0)}
      <li class="disabled"><a href="javascript:void(0)">...</a></li>
      {/if}
    {/for}


    <li>
      <a href="?page={$rets.next}&sort={$rets.sort}" aria-label="下一页">
        <span aria-hidden="true">下一页</span>
      </a>
    </li>


  </ul>
</nav>